import { loginApi } from '@/api/user'
const state = {
  token: ''
}

const getters = {}

const mutations = {
  setToken(state, newToken) {
    state.token = newToken
  }
}

const actions = {
  // 调登录接口
  login(store, loginForm) {
    loginApi(loginForm).then(res => {
      console.log(res)
      const token = res.data.data
      store.commit('setToken', token)
    })
  }
}

export default {
  namespaced: true,
  state,
  getters,
  mutations,
  actions
}

